package com.smart.system.domain.enums;

public enum AlarmType {
    TYPE_1(1, "普通报警"),
    SOS_ALARM(2, "SOS 报警"),
    LOW_BATTERY(3, "电量过低"),
    FALL_DETECTION(4, "跌倒报警"),
    HEART_RATE_ABNORMAL(5, "心率超标"),
    BLOOD_PRESSURE_ABNORMAL(6, "血压超标"),
    CHARGER_REMOVED(7, "充电器拔出"),
    SEDENTARY_REMINDER(8, "久坐提醒"),
    CHARGER_CONNECTED(9, "充电器连接"),
    BLOOD_SUGAR_ABNORMAL(10, "血糖超标"),
    DEVICE_BOOTED(11, "设备已开机"),
    BLOOD_OXYGEN_ABNORMAL(12, "血氧超标"),
    WATCH_REMOVED(13, "手表已经摘除"),
    PHONE_CALL(22, "普通电话呼叫"),
    FENCE_ENTER(23, "电子围栏报警-进入围栏"),
    FENCE_EXIT(24, "电子围栏报警-离开围栏"),
    BODY_TEMPERATURE_ABNORMAL(25, "体温超标"),
    MEDICATION_OVERDUE(36, "漏服药物"),
    WATCH_WORN(38, "手表已经佩戴"),
    VOICE_SOS(40, "语音\"救命\""),
    SERVICE_NUMBER_CALL(100, "服务号码呼叫"),
    PATIENT_CONSULTATION(101, "患者咨询,请回电"),
    CHECK_IN(102, "已签到"),
    ROOM_OCCUPIED(103, "房间里有人,活动探测仪"),
    ROOM_UNOCCUPIED(104, "房间里无人,活动探测仪"),
    ROOM_LIGHT_ON(105, "房间开灯,活动探测仪"),
    ROOM_LIGHT_OFF(106, "房间关灯,活动探测仪"),
    ROOM_SPEECH_DETECTED(107, "房间有人说话,活动探测"),
    ROOM_SPEECH_UNDETECTED(108, "房间无人说话,活动探测"),
    ROOM_MOVEMENT_DETECTED(109, "房间有人走动,活动探测"),
    ROOM_MOVEMENT_UNDETECTED(110, "房间无人走动,活动探测"),
    BED_LEAVE(120, "离床"),
    CLOCK_IN(122, "上班打卡"),
    CLOCK_OUT(123, "下班打卡"),
    DEVICE_OFFLINE(129, "设备离线");

    private final int type;
    private final String description;

    AlarmType(int type, String description) {
        this.type = type;
        this.description = description;
    }

    public int getType() {
        return type;
    }

    public String getDescription() {
        return description;
    }

    public static AlarmType fromType(int type) {
        for (AlarmType alarmType : AlarmType.values()) {
            if (alarmType.getType() == type) {
                return alarmType;
            }
        }
        throw new IllegalArgumentException("Unknown alarm type: " + type);
    }
}